﻿using CG5_KT.Primitives;
using System.Collections.Generic;

namespace CG5_KT.Scene
{
    public class Model
    {
        public Vector3 Position { get; set; }
        public List<Mesh> Meshes { get; set; }

        public Model()
        {
            this.Meshes = new List<Mesh>();
        }

        public void Translate(Vector3 trans)
        {
            this.Position = new Vector3(
                this.Position.X + trans.X,
                this.Position.Y + trans.Y,
                this.Position.Z + trans.Z);

            for (int i = 0; i < this.Meshes.Count; i++)
            {
                var mesh = this.Meshes[i];
                mesh.Position = new Vector3(
                    mesh.Position.X + trans.X,
                    mesh.Position.Y + trans.Y,
                    mesh.Position.Z + trans.Z);
            }
        }

        public void Rotate(Vector3 rotation)
        {
            for (int i = 0; i < this.Meshes.Count; i++)
            {
                var mesh = this.Meshes[i];
                mesh.Rotation = rotation;
            }
        }
    }
}
